<script language="javascript" src="./include/js/validate.js"></script>
<link rel="stylesheet" href="include/js/xheditor.css" type="text/css" media="screen" />
<script language="javascript" src="include/js/jquery.js?v=1.3.2"></script>
<script language="javascript" charset="utf-8" src="include/js/xheditor.js?v=0.9.6"></script>

<script type="text/javascript">

function getdir(type)
{
		var filepath = $('#filepath')[0].value;
		var filename = $('#filename')[0].value;
	$.ajax({
			type: "POST",
			url: "admincp.php",
			data: "action=special&op=getdir&filepath="+filepath+"&filename="+filename+"&type="+type,
			success: function(msg){
				if(msg == 1) {
					alert('目录已存在，确定使用此目录吗');
					return false;
				}else if(msg == 2) {
					alert('文件已存在，确定覆盖此文件吗');
					return false;
				}
			}
		});
}

function insertsid(sid)
{
	$(function() {
		$('#shopid').val(sid);
	})
}

function changeurl()
{
	if($('#islink').attr('checked')==true)
	{
		$('#url').attr('disabled','');
		$('#delre').html('');
	}
	else
	{
		$('#url').attr('value','');
		$('#url').attr('disabled','disabled');
		$('#delre').html('<td colspan=2><table cellpadding=0 cellspacing=0 border=0 width=100%><tr id=headext><th>头部扩展代码</th><td><textarea name=d[headextend] id=headextend cols=100 rows=5 onkeyup=textareasize(this); style=font:14px sans-serif;></textarea><div id=headextendtips class=tips>可以填写本专题需要用的特殊样式代码，不清楚请留空。</div></td></tr><tr id=banner><th>头图</th><td><input name=bannerimg type=file id=bannerimg size=40 /><div id=bannerimgtips class=tips>专题模板所用头部横图</div></td></tr><tr id=template><th>模板分类</th><td><select name=d[template]><option value=zhuanti>默认模板</option><?=$zhuanti_template_select?></select></td>	</tr><th><em>专题文件夹路径 *</em></th><td><input name=d[filepath] type=text id=filepath size=20>/<input name=d[filename] type=text id=filename size=20 onchange=getdir() dataType=Require msg=请填写文件名 >.shtml<div id=filenametips class=tips>专题所用文件名</div></td></tr></table></td>');
	}
}

function textareasize(obj)
{
	if(obj.scrollHeight > 70) {
		obj.style.height = obj.scrollHeight + 'px';
	}
}
</script>
<script language="javascript" src="./include/js/upload.js"></script>
	<div id="nav">
		当前位置: <a href="?action=default">管理首页</a> <span>&gt;</span> 发布专题
	</div>
	<form id="theform" name="theform" action="" method="post" class="block" enctype="multipart/form-data" onSubmit="return Validator.Validate(this,2);">
	<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
		<th style="padding-bottom: 5px; font-size: 12px; font-weight: bold;"><em>*为必填项</em></th>
		<td>&nbsp;</td>
		</tr>
		<tr>
		<th style="width: 7em;"><em>专题标题 *</em></th>
		<td><input name="d[title]" type="text" id="title" size="60" maxlength="80" dataType='Require' msg='请填写长标题' /><div id="titletips" class="tips">文章标题不超过40个汉字</div></td>
		</tr>
		
		<tr>
		<th>来源</th>
		<td><input name="d[origin]" type="text" id="origin" size="10" maxlength="15" value="本站" /><div id="origintips" class="tips">文章来源，10个汉字以内</div></td>
		</tr>
		
		<tr>
		<th>作者</th>
		<td><input name="d[author]" type="text" id="author" size="10" maxlength="10" value="佚名" /><div id="authortips" class="tips">文章作者，6个汉字以内</div></td>
		</tr>	
			
        <tr>
		<th>摘要</th>
		<td><textarea id="description" name="d[description]" rows="5" cols="80"></textarea><div id="descriptiontips" class="tips">留空则由程序自动截取内容栏的前25字作为摘要</div></td>
		</tr>
		
        <tr>
		<th>是否外链</th>
		<td><input name="d[islink]" id="islink" type="checkbox" value="1" onclick="changeurl();" /> <input name="d[url]" type="text" id="url" size="60" maxlength="255" disabled /><div id="urltips" class="tips">请填写链接地址</div></td>
		</tr>
        		
		<tr id="thumb">
		<th>展示图</th>
		<td><input name="showimg" type="file" id="showimg" size="40" /><div id="showimgtips" class="tips">展示图，请注意各分类下展示图大小不一样.</div></td>
		</tr>
		<tr id="delre">
        <td colspan="2">
        <table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr id="headext">
		<th>头部扩展代码</th>
		<td><textarea name="d[headextend]" id="headextend" cols="100" rows="5" onkeyup="textareasize(this);" style="font:14px sans-serif;"></textarea><div id="headextendtips" class="tips">可以填写本专题需要用的特殊样式代码，不清楚请留空。</div></td>
		</tr>
		
		<tr id="banner">
		<th>头图</th>
		<td><input name="bannerimg" type="file" id="bannerimg" size="40" /><div id="bannerimgtips" class="tips">专题模板所用头部横图</div></td>
		</tr>
		
		<tr id="template">
		<th>模板分类</th>
		<td><select name="d[template]"><option value="zhuanti">默认模板</option><?=$zhuanti_template_select?></select></td>
		</tr>
		
		<tr>
		<th><em>专题文件夹路径 *</em></th>
		<td><input name="d[filepath]" type="text" id="filepath" size="20" onchange="getdir(1)" dataType='Require' msg='请填写文件路径'  /><div id="filepathtips" class="tips">专题所用文件夹路径</div>/<input name="d[filename]" type="text" id="filename" size="20" onchange="getdir()"  value="index" dataType='Require' msg='请填写文件名' />.shtml<div id="filenametips" class="tips">专题所用文件名</div></td>
		</tr>
        </table>
        </td>
        </tr>
		<tr>
		<th>状态</th>
		<td><input name="d[status]" type="radio" value="1" id="status1" checked="checked" /><label for="status1">直接发布</label> <input name="d[status]" type="radio" value="2" id="status2" /><label for="status2"><font color="red">发布并推荐</font></label> <input name="d[status]" type="radio" value="0" id="status3" /><label for="status3">存为草稿</label> 权重：<input name="d[weighing]" type="text" id="weighing" size="2" maxlength="2" value="" /><div id="weighingtips" class="tips">可填3-99,数值越大，排名越靠前。</div></td>
		</tr>
		
		<tr>
		<th>&nbsp;</th>
		<td>
		<button value="true" type="submit" name="dosubmit" class="submit">提交保存</button></td>
		</tr>
	</table>
	</form>